package com.daoeping.service.impl;

import java.util.List;

import com.daoeping.dao.UserProductionDao;
import com.daoeping.domain.Usr_userProduction;
import com.daoeping.service.UserProductionService;
import java.text.SimpleDateFormat;
import java.util.Date;

public class UserProductionServiceImpl implements UserProductionService {

	private UserProductionDao userProductionDao;
	Date now = new Date();
	
	public UserProductionDao getUserProductionDao() {
		return userProductionDao;
	}

	public void setUserProductionDao(UserProductionDao userProductionDao) {
		this.userProductionDao = userProductionDao;
	}

	
	public Date getNow() {
		return now;
	}

	public void setNow(Date now) {
		this.now = now;
	}

	@Override
	public boolean addUserProduction(Usr_userProduction usr_userProduction) {
		// TODO Auto-generated method stub
		
		//SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
		//String sysDatetime = fmt.format(now);
		usr_userProduction.setCreatedDate(now);		
		return this.userProductionDao.insertData(usr_userProduction);
	}

	@Override
	public boolean updateUserProduction(Usr_userProduction usr_userProduction) {
		// TODO Auto-generated method stub
		usr_userProduction.setUpdateDate(now);
		return this.userProductionDao.updateData(usr_userProduction);
	}

	@Override
	public boolean deleteUserProduction(Usr_userProduction usr_userProduction) {
		// TODO Auto-generated method stub
		return this.userProductionDao.deleteData(usr_userProduction);
	}


	@Override
	public List<Usr_userProduction> findAllUserProduction() {
		// TODO Auto-generated method stub
		return (List<Usr_userProduction>) this.userProductionDao.findAllUserProduction();
		
	}

	@Override
	public List findUserProductionByUserID(int userid) {
		// TODO Auto-generated method stub		
		return (List) this.userProductionDao.findUserProductionByUserID(userid);
	}

	@Override
	public List<Usr_userProduction> findUserProductionByID(int id) {
		// TODO Auto-generated method stub
		return (List<Usr_userProduction>) this.userProductionDao.SelectUsr_userProductionById(id);
	}

}
